/**************************************************************************//**
\file  tmp175.h

\brief Declarations of tmp175 interface. Copied from lm73.h file from 
	MeshBean Board

\author
	Ricardo Rodrigues
	
\internal
  History:
    15/06/12 R. Rodrigues - Created
*******************************************************************************/

#ifndef _TMP175_SENSOR_H
#define _TMP175_SENSOR_H

/******************************************************************************
                   Includes section
******************************************************************************/
#include <types.h>
#include <bspTaskManager.h>

//#include <debug.h>
//#include <stdio.h>

/******************************************************************************
                   Types section
******************************************************************************/
// states
typedef enum
{
  TMP175_IDLE,					// idle
  TMP175_RETURN,				// return to top layer task handler
  TMP175_WAIT,					// delay
  TMP175_SET_CONFIG,			// configure the device
  TMP175_GET_TEMP,
  TMP175_FORMAT_TEMP
} Tmp175States_t;

// Control structure
typedef struct  {
	int32_t tmp175Data;									// Contains the result of sampling
	bool tmp175Result;									// return value BC_SUCCESS/BC_FAIL
	void(* tmp175Callback)(bool error, int16_t data);	// callback
} Tmp175Control_t;

/******************************************************************************
                   Prototypes section
******************************************************************************/
/**************************************************************************//**
\brief  Initializes the sensor and starts reads the calibration values.

\param[in]
  bmp085Result - pointer to a variable holding the result BC_SUCCESS/FAIL of
				 the whole operation.
\param[in]
  bmp085Pressure - pointer to a variable that will hold the pressure value.

\return
  BC_FAIL - if the sensor was open and running other tasks.
  BC_SUCCESS - other case.

******************************************************************************/
result_t openTmp175(void);

/**************************************************************************//**
\brief  Performs the test if the component have completed request.

\return
  BC_FAIL - the previous request is not completed.
  BC_SUCCESS - otherwise.
******************************************************************************/
result_t closeTmp175(void);

/**************************************************************************//**
\brief Reads the temperature value.
******************************************************************************/
result_t readTmp175Data(void (*f)(bool result, int16_t data));

#endif /* _TMP175_SENSOR_H */
// eof tmp175.h
